﻿using System.Windows.Forms;
using System.Drawing;

namespace RoleUpdater.DelegatesHelpers
{
    public class LabelDelegates
    {
        public static void SetText(Label lbl, string text)
        {
            MethodInvoker mi = delegate
                                   {
                                       lbl.Text = text;
                                   };

            if (lbl.InvokeRequired)
            {
                lbl.Invoke(mi);
            }
            else
            {
                mi();
            }

        }

        public static void SetColor(Label lbl, Color color)
        {
            MethodInvoker mi = delegate
                                   {
                                       lbl.ForeColor = color;
                                   };

            if (lbl.InvokeRequired)
            {
                lbl.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
    }
}